package cn.powerone.scm.service.impl;

import java.util.List;
import cn.powerone.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.powerone.scm.mapper.ScmDefectInfoMapper;
import cn.powerone.scm.domain.ScmDefectInfo;
import cn.powerone.scm.service.IScmDefectInfoService;

/**
 * 不良品信息记录Service业务层处理
 * 
 * @author PowerOne
 * @date 2025-08-05
 */
@Service
public class ScmDefectInfoServiceImpl implements IScmDefectInfoService 
{
    @Autowired
    private ScmDefectInfoMapper scmDefectInfoMapper;

    /**
     * 查询不良品信息记录
     * 
     * @param id 不良品信息记录主键
     * @return 不良品信息记录
     */
    @Override
    public ScmDefectInfo selectScmDefectInfoById(Long id)
    {
        return scmDefectInfoMapper.selectScmDefectInfoById(id);
    }

    /**
     * 查询不良品信息记录列表
     * 
     * @param scmDefectInfo 不良品信息记录
     * @return 不良品信息记录
     */
    @Override
    public List<ScmDefectInfo> selectScmDefectInfoList(ScmDefectInfo scmDefectInfo)
    {
        return scmDefectInfoMapper.selectScmDefectInfoList(scmDefectInfo);
    }

    /**
     * 新增不良品信息记录
     * 
     * @param scmDefectInfo 不良品信息记录
     * @return 结果
     */
    @Override
    public int insertScmDefectInfo(ScmDefectInfo scmDefectInfo)
    {
        scmDefectInfo.setCreateTime(DateUtils.getNowDate());
        return scmDefectInfoMapper.insertScmDefectInfo(scmDefectInfo);
    }

    /**
     * 修改不良品信息记录
     * 
     * @param scmDefectInfo 不良品信息记录
     * @return 结果
     */
    @Override
    public int updateScmDefectInfo(ScmDefectInfo scmDefectInfo)
    {
        scmDefectInfo.setUpdateTime(DateUtils.getNowDate());
        return scmDefectInfoMapper.updateScmDefectInfo(scmDefectInfo);
    }

    /**
     * 批量删除不良品信息记录
     * 
     * @param ids 需要删除的不良品信息记录主键
     * @return 结果
     */
    @Override
    public int deleteScmDefectInfoByIds(Long[] ids)
    {
        return scmDefectInfoMapper.deleteScmDefectInfoByIds(ids);
    }

    /**
     * 删除不良品信息记录信息
     * 
     * @param id 不良品信息记录主键
     * @return 结果
     */
    @Override
    public int deleteScmDefectInfoById(Long id)
    {
        return scmDefectInfoMapper.deleteScmDefectInfoById(id);
    }
}
